/*
*  gclist.h - UI Contact list functions
*  Copyright (c) 2005 Derek Ingrouville (dergro@users.sourceforge.net)
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU Library General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#ifndef _GCLIST_H
#define _GCLIST_H

typedef struct _GCList GCList;

#include "gmain.h"

typedef enum _GCListColumns
{
	COL_PASSPORT = 0,
	COL_NICKNAME,
	COL_GROUPNAME,
	COL_GROUPGUID,
	COL_STATUS,
	COL_ISCONTACT,
	NUM_COLS
} GCListColumns;

struct _GCList
{
	GMainWindow *gmain;
	GtkScrolledWindow *scrolled_window;
	GtkTreeView *view;
	GtkTreeModel *model;
	GtkMenu *popup_contact;
	GtkMenu *popup_group;
	gboolean show_offline_contacts;
	gboolean show_empty_groups;
};

GCList *gclist_new (GMainWindow *gmain);
void gclist_reset (GCList *gclist);
void gclist_free (GCList *gclist);

/* Find group in clist. sets dest_iter to the row iter */
gboolean gclist_find_group (GtkTreeModel *model, 
			    gchar *guid, 
			    GtkTreeIter *dest_iter);

/* Find contact in group. sets dest_iter to the row iter */
gboolean gclist_group_find_contact (GtkTreeModel *model,
				    const char *passport,
				    GtkTreeIter *group_iter,
				    GtkTreeIter *dest_iter);

int gclist_add_group (GCList *gclist, MsnGroup *group);
int gclist_update_group (GCList *gclist, MsnGroup *group);
int gclist_remove_group (GCList *gclist, gchar *group_guid);

int gclist_add_contact (GCList *gclist, MsnContact *contact);
int gclist_update_contact (GCList *gclist, MsnContact *contact);

void gclist_set_show_offline_contacts (GCList *gclist, gboolean show_offline);
void gclist_set_show_empty_groups (GCList *gclist, gboolean show_empty);

/* TODO: relocate this function */
gchar *get_string_from_status (MsnStatus status);

#endif /* _GCLIST_H */
